import request from '@/utils/request'

export default {
  getList: function (params) {
    return request({
      url: '/sysRole/list',
      method: 'post',
      data:params
    })
  },
  save: function (params) {
    let url = 'save'
    if(params.id){
      url = 'updateById'
    }
    return request({
      url: '/sysRole/'+url,
      method: 'post',
      data: params
    })
  },
  remove: function (roleId) {
    return request({
      url: '/sysRole/delete/'+roleId,
      method: 'get',
    })
  },
  roleTreeListByIdUser: function (idUser) {
    return request({
      url: '/sysRole/getByUserId/'+idUser,
      method: 'get'
    })
  },
  savePermissons: function (params) {
    return request({
      url: '/sysRole/savePermisson/'+params.roleId,
      method: 'post',
      data:params.permissionIds
    })
  },
  getNoticeType: function () {
    return request({
      url: '/sysRole/getNoticeType',
      method: 'get'
    })
  },
  getRoleNotice: function (id) {
    return request({
      url: '/sysRole/getRoleNotice/'+id,
      method: 'get'
    })
  },
  saveNotice: function (id,data) {
    return request({
      url: '/sysRole/saveNotice/'+id,
      method: 'post',
      data
    })
  },
}
